package com.financing.platform.dao.impl;

import java.sql.SQLException;
import java.util.Collections;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.financing.platform.dao.IMessageDao;
import com.financing.platform.dto.MessageDTO;
import com.financing.platform.util.SqlName;


@Repository("messageDaoImpl")
public class MessageDaoImpl extends BaseDaoImpl implements IMessageDao {

	public int addMessage(MessageDTO messageDTO) throws SQLException {
		return (Integer) this.sqlMapClient.insert(SqlName.addMessage, messageDTO);
	}

	@SuppressWarnings("unchecked")
	public List<MessageDTO> messageList(MessageDTO messsageDTO){
		try {
			return (List<MessageDTO>) this.sqlMapClient.queryForList(SqlName.queryMesaage, messsageDTO);
		} catch (SQLException e) {
			log.error("Query messsage list error!", e);
			return Collections.emptyList();
		}
	}


}
